from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional
from pydantic import BaseModel

class Memory(BaseModel):
    """Base class for agent memory entries."""
    timestamp: float
    content: Any
    type: str
    metadata: Dict[str, Any] = {}

class Capability(ABC):
    """Base class for agent capabilities."""
    
    @abstractmethod
    def execute(self, *args, **kwargs) -> Any:
        """Execute the capability."""
        pass

    @abstractmethod
    def can_handle(self, task: str) -> bool:
        """Check if this capability can handle the given task."""
        pass

class WebSearchCapability(Capability):
    """Web search capability."""
    def execute(self, query: str) -> List[Dict[str, str]]:
        # Implement web search logic
        pass

    def can_handle(self, task: str) -> bool:
        return "search" in task.lower() or "find information" in task.lower()

class CodeAnalysisCapability(Capability):
    """Code analysis capability."""
    def execute(self, code: str) -> Dict[str, Any]:
        # Implement code analysis logic
        pass

    def can_handle(self, task: str) -> bool:
        return "analyze code" in task.lower() or "review code" in task.lower()

class ImageGenerationCapability(Capability):
    """Image generation capability."""
    def execute(self, prompt: str) -> str:
        # Implement image generation logic
        pass

    def can_handle(self, task: str) -> bool:
        return "generate image" in task.lower() or "create image" in task.lower()

class TextProcessingCapability(Capability):
    """Text processing capability."""
    def execute(self, text: str, operation: str) -> str:
        # Implement text processing logic
        pass

    def can_handle(self, task: str) -> bool:
        return any(op in task.lower() for op in ["summarize", "translate", "analyze text"]) 